package com.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.entity.Category;
import com.entity.Transaction;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper extends BaseMapper<Category> {
    /**
     * 根据分类ID查询分类
     * @param id 分类ID
     * @return 分类的一条记录
     */
    @Select("SELECT * FROM categories WHERE id = #{id}")
    Transaction getCategoryById(int id);

    /**
     * 根据userid查询他所有的分类
     *
     */
    @Select("SELECT * FROM categories WHERE user_id = #{id}")
    List<Category> getCategoryList(int id);
}
